package com.huatai.datadevelop.websocket;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author hecai
 * @description: TODO
 * @date 2023/2/13 14:38
 * @Version 1.0
 */
public class countAddAndRes {
    private static volatile AtomicInteger onlineCount = new AtomicInteger(0);

    /**
     * 数值+1
     * @return
     */
    public static Integer addNumber(){
        onlineCount.incrementAndGet();
        return onlineCount.get();
    }

    /**
     * 数值-1
     * @return
     */
    public static Integer decrement(){
        onlineCount.decrementAndGet();
        return onlineCount.get();
    }
}
